extends Area2D

@onready var collision_shape: CollisionShape2D = $CollisionShape2D

func _ready():
	# 添加到"end_point"组以便识别
	add_to_group("end_point")

func _process(delta):
	position.x -= 10 * delta * 60

func is_point_inside(point: Vector2) -> bool:
	# 假设你的CollisionShape2D是矩形形状
	if not collision_shape or not collision_shape.shape:
		return false
	
	# 将点转换到碰撞形状的局部坐标系
	var local_point = to_local(point) - collision_shape.position
	
	# 检查是否在矩形内
	var shape = collision_shape.shape
	if shape is RectangleShape2D:
		var half_size = shape.size * 0.5
		return (abs(local_point.x) <= half_size.x and abs(local_point.y) <= half_size.y)
	
	return false
